package com.cb.eureka.ribbon.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;

@Service
public class HelloService {
	@Autowired
    RestTemplate restTemplate;

	//@HystrixCommand(fallbackMethod = "hiServiceFallback")
    public String hiService(String name) {
		try{
			return restTemplate.getForObject("http://EurekaClient/hi?name="+name,String.class);
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
    }
    
    public String hiServiceFallback(String name){
		return "i have a error";
	}

}
